//
//  ItemFirstZaoItemViewController.m
//  Lovelife
//
//  Created by apple on 15/4/27.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ItemFirstZaoItemViewController.h"
#import "UIImageView+WebCache.h"
#import "ItemFirstZaoCell.h"
#import "ItemFirstThressCanDetasilsModel.h"
#import "WebViewController.h"
#import "ItemZeroModel.h"
#import "NightManager.h"



@interface ItemFirstZaoItemViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,retain)UITableView *breakfastTableView;

@end



@implementation ItemFirstZaoItemViewController


-(void)dealloc
{
    [_breakfastTableView release];
    [_zaoModelArr release];
    [super dealloc];


}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    
    self.breakfastTableView = [[UITableView alloc]initWithFrame:[[UIScreen mainScreen]bounds] style:UITableViewStyleGrouped];
    
    self.breakfastTableView.backgroundColor = [UIColor colorWithRed:247/255.0 green:248/255.0 blue:236/255.0 alpha:1];
    
    
    [self.view addSubview:self.breakfastTableView];
    
    [_breakfastTableView release];
    
    self.breakfastTableView.delegate = self;
    
    self.breakfastTableView.dataSource =self;

  
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;


}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
     static NSString *reuse = @"reuse";
    
    ItemFirstZaoCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    
    if (!cell) {
        cell = [[[ItemFirstZaoCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse]autorelease];
    }
    
    ItemFirstThressCanDetasilsModel *zao = self.zaoModelArr[indexPath.row];
    
    [cell.Img sd_setImageWithURL:[NSURL URLWithString:zao.thumb]];
    
    cell.title.text = zao.title;
    
   cell.zaocanLB.text = @"早餐";
    
    
    return cell;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return self.view.frame.size.height/3+90;


}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ItemZeroModel *zero = [[ItemZeroModel alloc]init];
    zero = self.zaoModelArr[indexPath.row];

    WebViewController *controller = [[WebViewController alloc]init];
    
    zero.url =  [NSString stringWithFormat:@"http://ibaby.ipadown.com/api/food/food.show.detail.php?id=%@",zero.ID];

    
    controller.url = [NSString stringWithFormat:@"http://ibaby.ipadown.com/api/food/food.show.detail.php?id=%@",zero.ID];
    
    controller.model = zero;
    
    
    [self.navigationController pushViewController:controller animated:YES];



}

-(void)setNightDayModel
{
    [NightManager setBackgroundColorWithView:self.view];
    
}

-(void)setLightDayModel
{
    [NightManager setBackgroundColorWithView:self.view];
    
}










    





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
